package ejb.dto;

import java.util.Date;

import org.joda.time.DateTime;
import org.joda.time.Days;


public class HotelAvailabilityDTO {
	
	private int id;
	private Date fromDate;
	private float price;
	private int remaining;
	private Date toDate;
	private HotelDTO hotel;
	private String hotelName;	
	private RoomDTO room;	
	private int hotelId;	
	private int roomId;


	//GETTER AND SETTER
	
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date getFromDate() {
		return this.fromDate;
	}

	public void setFromDate(Date fromDate) {
		this.fromDate = fromDate;
	}

	public float getPrice() {
		return this.price;
	}

	public void setPrice(float price) {
		this.price = price;
	}

	public int getRemaining() {
		return this.remaining;
	}

	public void setRemaining(int remaining) {
		this.remaining = remaining;
	}

	public Date getToDate() {
		return this.toDate;
	}

	public void setToDate(Date toDate) {
		this.toDate = toDate;
	}

	public HotelDTO getHotel() {
		return this.hotel;
	}

	public void setHotel(HotelDTO hotel) {
		this.hotel = hotel;
	}

	public RoomDTO getRoom() {
		return this.room;
	}

	public void setRoom(RoomDTO room) {
		this.room = room;
	}

	public String getHotelName() {
		return hotelName;
	}

	public void setHotelName(String hotelName) {
		this.hotelName = hotelName;
	}
	
	public int getHotelId() {
		return hotelId;
	}

	public void setHotelId(int hotelId) {
		this.hotelId = hotelId;
	}

	public int getRoomId() {
		return roomId;
	}

	public void setRoomId(int roomId) {
		this.roomId = roomId;
	}

	
	//METHODS
	
	@Override
	public boolean equals(Object obj) {
		if(obj==null) {
			return false;
		}
		HotelAvailabilityDTO h = (HotelAvailabilityDTO) obj;
		if(this.id == h.getId()) {
			return true;
		}
		return false;
	}
	
	/**
	 * Return days between two Date
	 * @return Return days between two Date
	 */
	public int getDays() {
		return Days.daysBetween(new DateTime(fromDate), new DateTime(toDate)).getDays();
	}
	
	

}